package com.flying.test;

import java.util.Arrays;
import java.util.List;

public class StreamsExample1 {
    public static void main(String[] args) {
        List<Person> people = Arrays.asList(
                new Person(60, "Charles", "Dickens"),
                new Person(42, "Lewis", "Carroll"),
                new Person(51, "Thomas", "Carlyle"),
                new Person(45, "Charlotte", "Bronte"),
                new Person(39, "Matthew", "Arnold")
        );

        people.stream()
                .filter(person -> person.getLastName().startsWith("C"))
                .forEach(p -> System.out.println(p.getFirstName()));

    }
}
